import * as tagsApi from '../../api/hmmm/tags'
const tagsInfo = {
  namespaced: true,
  state: {
    tagsList: {},
    simpleList: {},
    tagsDetail: {},
    tagsSimpleList: {}
  },
  mutations: {
    SET_TAGS_LIST: (state, newValue) => {
      state.tagsList = newValue
    },
    SET_SIMPLE_LIST: (state, newValue) => {
      state.simpleList = newValue
    },
    SET_TAGS_DETAIL: (state, newValue) => {
      state.tagsDetail = newValue
    },
    SET_TAGS_SIMPLE_LIST: (state, newValue) => {
      state.tagsSimpleList = newValue
    },
  },
  actions: {
    async updateTagsList (context, data) {
      const res = await tagsApi.getTagsList(data)
      context.commit('SET_TAGS_LIST', res)
    },
    async updateSimpleList (context) {
      const res = await tagsApi.getSimpleList()
      context.commit('SET_SIMPLE_LIST', res)
    },
    async updateTagsDetail (context, data) {
      const res = await tagsApi.getTagsDetail(data)
      context.commit('SET_TAGS_DETAIL', res)
    },
    async updateTagsSimpleList(context, data) {
      const res = await tagsApi.getTagsSimpleList(data)
      context.commit('SET_TAGS_SIMPLE_LIST', res)
    }
  }
}

export default tagsInfo
